<template>
  <view class="page-service-submit">
    <view class="bg"></view>
    <view class="info">
      <van-cell-group inset>
        <van-cell title="医院" :value="pageParams.orgName" size="large">
          <template #icon>
            <image mode="aspectFill" :src="icon.hospital" />
          </template>
        </van-cell>
        <van-cell title="科室" :value="pageParams.officeName" size="large">
          <template #icon>
            <image mode="aspectFill" :src="icon.hospital" />
          </template>
        </van-cell>
        <!-- <fly-picker title="医生" :value.sync="form.staffId" :list="initData.staffList" :z-index="101" input-align="right" size="large" is-link>
          <template #icon>
            <image mode="aspectFill" :src="icon.doctor" />
          </template>
        </fly-picker> -->
        <van-cell title="服务费" size="large" >
          <template #icon>
            <image mode="aspectFill" :src="icon.charge" />
          </template>
          <text class="c-blue">{{pageParams.payAmt}}元</text>
        </van-cell>
      </van-cell-group>
    </view>
    <view class="p-a-15 service">
      <view :class="checked ? 'fly-panel checked' : 'fly-panel'" @tap="getChecked">
        <view class="hd">
          <view class="title">温馨提示</view>
        </view>
        <view class="bd">
          <view>
          <template v-if="pageParams.consultType == 0">
            <view>服务类型：咨询</view>
            <view>服务内容：单次在线咨询医生。</view>
          </template>
          <template v-if="pageParams.consultType == 1">
            <view>服务类型：门诊</view>
            <view>服务内容：指定医生门诊加号，服务费不含医院院内挂号费。</view>
          </template>
          <template v-if="pageParams.consultType == 2">
            <view>服务类型：住院</view>
            <view>服务内容：为患者提供导诊、挂号、办理住院及与主诊医生对接，服务费不含医院院内各项收费。</view>
          </template>
          <template v-if="pageParams.consultType == 3">
            <view>服务类型：会诊</view>
            <view>服务内容：专家远程或线下会诊。</view>
          </template>
          </view>
        </view>  
      </view>  
    </view>
    <van-submit-bar
      button-type="info"
      button-color="#3678FD"
      button-text="微信支付"
      class="submit-bar-full-btn"
      @submit="payOrder"
    >
      <view slot="tip" class="align-center">
        备注：支付有效期3小时，超时失效
      </view>
    </van-submit-bar>
  </view>
</template>

<script>
  import flyPicker from '@/components/flyPicker';
  export default {
    data(){
      return{
        pageParams:{},
        icon:{
          hospital: this.$icon.hospital,
          doctor: this.$icon.doctor,
          charge: this.$icon.charge,
        },
        form:{
          staffId: 1,
        },
        checked: false,
        CompanionFees: 300,
        initData:{
          staffList:[
            {id: 1, name: '张医生'},
            {id: 2, name: '王医生'}
          ]
        }

      }
    },
    components:{
      flyPicker
    },
    onLoad(e){
      this.pageParams = e;
    },
    onShow(){
      this.userInfo = uni.getStorageSync('userInfo');
      
    },
    
    methods:{
      getChecked(){
        console.log(this.checked);
        this.checked = !this.checked;
      },
      
		payOrder(){
        uni.login({
						success: res => {
							let params = {
                billId: this.pageParams.lvtoReferralBillId,
                body: '推荐服务单支付',
                code: res.code,
                billType:1
              };
              this.$http('post', '/lvto/pay/payment',params, (data,msg) => {
                let obj = JSON.parse(data)
                uni.requestPayment({
                  provider: 'wxpay',
                  ...obj,
                  success: response => {
                    uni.switchTab({
                      url: '/pages/order/index'
                    })
                  }
                })
              })
              
						},
					})
      }
    }
  }
</script>